package com.rayson.oneapi.model.req.user;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * 用户注册请求体
 *
 * @author <a href="https://github.com/liyupi">程序员鱼皮</a>
 * @from <a href="https://yupi.icu">编程导航知识星球</a>
 */
@Data
public class UserRegisterRequest implements Serializable {

    private static final long serialVersionUID = 3191241716373120793L;

    @NotBlank(message = "用户名不能为空")
    @Length(message = "用户名不能低于4位", min = 4)
    private String username;

    @NotBlank(message = "密码不能为空")
    @Length(message = "密码不能低于8位", min = 8)
    private String password;

    @NotBlank(message = "确认密码不能为空")
    private String checkPassword;


    public boolean isPasswordSame() {
        return password.equals(checkPassword);
    }
}
